package Sort.Comparable;

public class TestComparable {
    public static void main(String[] args) {
        Student s1 = new Student();
        s1.setName("迪丽热巴");
        s1.setAge(18);
        Student s2 = new Student();
        s2.setName("古力娜扎");
        s2.setAge(20);

        Comparable max = getMax(s1, s2);
        System.out.println(max);
    }

    private static Comparable getMax(Comparable c1,Comparable c2) {
        int age = c1.compareTo(c2);
        if (age>=0) {
            return c1;
        }else {
            return c2;
        }
    }
}
